var React = require('react');
var AppView = require('../../common/component/view/app-view.node');
var ModalDialog = require('../../common/component/dialog/modal-dialog.node');
var ModalBody = require('../../common/component/dialog/modal-body.node');
var ModalFooter = require('../../common/component/dialog/modal-footer.node');

module.exports = <>
  <AppView viewTitle="${t('ui.infrastructure.lov.title.lovManagement')}">


    <div className="x-search-bar">
      <form>
        <div className="form-row align-items-center">
          <div className="col-auto">
            <label className="sr-only" htmlFor="valueSetCode"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.lov.field.valueSetCode')}"}</div>
              </div>
              <input type="text" className="form-control" id="valueSetCode" data-x-name="searchField.valueSetCode"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <label className="sr-only" htmlFor="valueSetName"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.lov.field.valueSetName')}"}</div>
              </div>
              <input type="text" className="form-control" id="valueSetName" data-x-name="searchField.valueSetName"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <label className="sr-only" htmlFor="valueSetDesc"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.lov.field.valueSetDesc')}"}</div>
              </div>
              <input type="text" className="form-control" id="valueSetDesc" data-x-name="searchField.valueSetDesc"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <div className="form-check mb-2">
              <input className="form-check-input" type="checkbox" id="enableFlagOnly"
                data-x-name="searchField.enableFlagOnly" data-x-type="checkbox-boolean" />
              <label className="form-check-label" htmlFor="enableFlagOnly">
                {"${t('ui.infrastructure.lov.queryField.enableFlagOnly')}"}
              </label>
            </div>
          </div>

          {/* 查询按钮 */}
          <div className="col-auto">
            <button type="button" className="btn btn-primary mb-2" data-x-ui="searchBtn">
              {"${t('ui.system.common.btn.search')}"}
            </button>
          </div>
        </div>
      </form>
    </div>

    <div className="x-tool-bar">
      <button type="button" className="btn btn-outline-primary mb-2 btn-sm" data-x-ui="createBtn">
        {"${t('ui.system.common.btn.create')}"}
      </button>
    </div>

    <table data-x-ui="lovTable" className="x-table-custom">
      <thead>
        <tr>
          <th data-field="id" data-visible="false">ID</th>
          <th data-field="valueSetCode">{"${t('ui.infrastructure.lov.field.valueSetCode')}"}</th>
          <th data-field="valueSetName">{"${t('ui.infrastructure.lov.field.valueSetName')}"}</th>
          <th data-field="valueSetDesc">{"${t('ui.infrastructure.lov.field.valueSetDesc')}"}</th>
          <th data-field="enableFlagDesc">{"${t('ui.system.common.field.enableFlag')}"}</th>
          <th>{"${t('ui.system.common.field.operate')}"}</th>
        </tr>
      </thead>
    </table>

    {/* "新建值列表"弹出框 */}
    <div data-x-ui="newLovDialog" className="modal" tabIndex="-1">
      <ModalDialog dialogTitle="${t('ui.infrastructure.lov.dialog.newLov')}">
        <ModalBody>
          <form>
            <div className="form-group x-form-required">
              <label htmlFor="valueSetCode">{"${t('ui.infrastructure.lov.field.valueSetCode')}"}</label>
              <input type="text" className="form-control" id="valueSetCode" name="valueSetCode" data-x-name="new.valueSetCode"
                placeholder={"${t('ui.system.common.placeholder.inputCodeLimitLength', 1, 50)}"} />
            </div>
            <div className="form-group x-form-required">
              <label htmlFor="valueSetName">{"${t('ui.infrastructure.lov.field.valueSetName')}"}</label>
              <input type="text" className="form-control" id="valueSetName" name="valueSetName" data-x-name="new.valueSetName"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 1, 100)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="valueSetDesc">{"${t('ui.infrastructure.lov.field.valueSetDesc')}"}</label>
              <input type="text" className="form-control" id="valueSetDesc" name="valueSetDesc" data-x-name="new.valueSetDesc"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 0, 200)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="enableFlag">{"${t('ui.system.common.field.enableFlag')}"}</label>
              <select className="form-control" id="enableFlag" name="enableFlag" data-x-name="new.enableFlag"
                defaultValue="true">
                <option value="true">{"${t('ui.system.common.option.enableFlag.true')}"}</option>
                <option value="false">{"${t('ui.system.common.option.enableFlag.false')}"}</option>
              </select>
            </div>
          </form>
        </ModalBody>
        <ModalFooter confirmLabel="${t('ui.system.common.btn.save')}" cancelLabel="${t('ui.system.common.btn.cancel')}" />
      </ModalDialog>
    </div>

    {/* "编辑值列表"弹出框 */}
    <div data-x-ui="editLovDialog" className="modal" tabIndex="-1">
      <ModalDialog dialogTitle="${t('ui.infrastructure.lov.dialog.editLov')}">
        <ModalBody>
          <form>
            <input type="hidden" id="id" name="id" data-x-name="edit.id" />
            <input type="hidden" id="versionNumber" name="versionNumber" data-x-name="edit.versionNumber" />

            <div className="form-group x-form-required">
              <label htmlFor="valueSetCode">{"${t('ui.infrastructure.lov.field.valueSetCode')}"}</label>
              <input type="text" className="form-control" id="valueSetCode" name="valueSetCode" data-x-name="edit.valueSetCode"
                placeholder={"${t('ui.system.common.placeholder.inputCodeLimitLength', 1, 50)}"} />
            </div>
            <div className="form-group x-form-required">
              <label htmlFor="valueSetName">{"${t('ui.infrastructure.lov.field.valueSetName')}"}</label>
              <input type="text" className="form-control" id="valueSetName" name="valueSetName" data-x-name="edit.valueSetName"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 1, 100)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="valueSetDesc">{"${t('ui.infrastructure.lov.field.valueSetDesc')}"}</label>
              <input type="text" className="form-control" id="valueSetDesc" name="valueSetDesc" data-x-name="edit.valueSetDesc"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 0, 200)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="enableFlag">{"${t('ui.system.common.field.enableFlag')}"}</label>
              <select className="form-control" id="enableFlag" name="enableFlag" data-x-name="edit.enableFlag"
                defaultValue="true">
                <option value="true">{"${t('ui.system.common.option.enableFlag.true')}"}</option>
                <option value="false">{"${t('ui.system.common.option.enableFlag.false')}"}</option>
              </select>
            </div>
          </form>
        </ModalBody>
        <ModalFooter confirmLabel="${t('ui.system.common.btn.save')}" cancelLabel="${t('ui.system.common.btn.cancel')}" />
      </ModalDialog>
    </div>

    <script src="${appJs('app/infrastructure/lov/lov-management.js')}" type="text/javascript"></script>
  </AppView>
</>
